<template>
  <div id="after-select">
    <div class="jx-content add-time">
      <el-form class="" :inline="true" ref="searchForm" :model="searchForm" label-width="80px">
        <el-form-item label="试题名称">
          <el-input v-model="searchForm.user"></el-input>
        </el-form-item>
        <el-form-item label="考试时间">
          <el-input v-model="searchForm.user"></el-input>
        </el-form-item>
        <el-form-item class="fr">
          <router-link class="button-style" to="/PreviewTestPaper">预 览</router-link>
          <div class="button-style">保存试卷</div>
        </el-form-item>
      </el-form>
    </div>
    <div class="jx-content" :class="{ 'is-modal': !isModal }">
      <div class="clearfix chose-model">
        <div v-show="isModal" class="title c-blue fs18 fbold fl">模板模式</div>
        <div class="fr c-blue fs16">
          <router-link to="/selectTemplate">
            <i class="iconfont icon-moban"></i>选择试题模板
          </router-link>
        </div>
      </div>
      <div class="clearfix">
        <div class="fl c-blue fs16">
          <span v-show="isModal">
            <i style="color:#3fdb9b;" class="iconfont icon-zhengque"></i>已选择模板</span>
          <span v-show="isModal" class="look-question">
            <span class="look-question-btn">
              <i class="iconfont icon-xianshidaan"></i>查看</span>
            <div class="look-question-content" v-show="lookContent">
              <div class="look-question-item">
                <div>选择题</div>
                <div>10题</div>
                <div>每题2分</div>
              </div>
              <div class="look-question-item">
                <div>填空题</div>
                <div>10题</div>
                <div>每题2分</div>
              </div>
              <div class="look-question-item">
                <div>判断题</div>
                <div>10题</div>
                <div>每题2分</div>
              </div>
              <div class="look-question-item">
                <div>简答题</div>
                <div>10题</div>
                <div>每题2分</div>
              </div>
              <div class="look-question-item">
                <div>编程题</div>
                <div>10题</div>
                <div>每题2分</div>
              </div>
              <div class="look-question-item">
                <div>实验题</div>
                <div>10题</div>
                <div>每题2分</div>
              </div>
              <div class="look-question-score">总分数：100分</div>
            </div>
          </span>
          <span class="del-modal" v-show="isModal" @click="isModal=false">
            <i class="iconfont icon-quxiao"></i>取消模板</span>
        </div>
        <div class="fr" v-show="isModal">
          该模板 共25题 已选择 24题 总分数：100分
        </div>
      </div>
    </div>
    <div class="jx-content" :class="{ 'is-modal-bottom': !isModal }">
      <!-- 预览弹出框 -->
      <el-dialog width="850" class="dialog-questions" title="试题预览" :visible.sync="dialogQuestion">
        <div class="dialog-content">
          <div class="question-title">关于媒体文件存储有点说法正确的是？</div>
          <div class="question-chose">A：
            <span class="question-flex">关于媒体文件存储有点说法正确的是，</span>
          </div>
          <div class="question-chose">B：
            <span class="question-flex">关于媒体文件存储有点说法正确的是关于媒体文件存储有点说法正确的是，关于媒体文件存储有点说法正确的是，关于媒体文件存储有点说法正确的是，关于媒体文件存储有点说法正确的是，关于媒体文件存储有点说法正确的是，关于媒体文件存储有点说法正确的是，关于媒体文件存储有点说法正确的是，关于媒体文件存储有点说法正确的是，</span>
          </div>
          <div class="question-chose">C：
            <span class="question-flex">关于媒体文件存储有点说法正确的是</span>
          </div>
          <div class="question-chose">D：
            <span class="question-flex">关于媒体文件存储有点说法正确的是</span>
          </div>
          <div class="question-answer">答案：
            <span class="chose">A</span>
          </div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button class="button-style" @click="dialogQuestion = false">确 定</el-button>
        </span>
      </el-dialog>
      <div class="search-box">
        <el-form class="fl" :inline="true" ref="searchForm" :model="searchForm" label-width="80px">
          <el-form-item label="章节名称">
            <el-select v-model="searchForm.region" placeholder>
              <el-option label="区域一" value="shanghai"></el-option>
              <el-option label="区域二" value="beijing"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <div class="button-style">搜 索</div>
          </el-form-item>
          <el-form-item>
            <span>该章节：单选题 4题 填空题 5题 判断题 6题 共 20分</span>
          </el-form-item>
        </el-form>
        <div v-show="!isModal" class="fr" style="margin-top:5px;">已选择 24题 总分数：100分</div>
      </div>
      <div class="clear"></div>
      <div>
        <el-tabs v-model="activeName" @tab-click="tabHandleClick">
          <el-tab-pane name="first">
            <span slot="label">
              <el-badge :value="firstChoseData.length" class="item">选择题</el-badge>
            </span>
            <div v-show="!isModal" class="one-question-score">
              每题分数：
              <el-input v-model="oneQuestionScore"></el-input>
            </div>
            <!--v-if控制切换表格闪烁-->
            <el-table :data="tableData" @selection-change="firstHandleSelectionChange" v-if="activeName === 'first'" style="width: 100%">
              <el-table-column type="selection" width="55"></el-table-column>
              <el-table-column prop="date" label="试题题目"></el-table-column>
              <el-table-column prop="name" label="试题类型" width="180"></el-table-column>
              <el-table-column prop="address" label="分数" width="180"></el-table-column>
              <el-table-column fixed="right" label="操作" width="200">
                <template slot-scope="scope">
                  <el-button @click="dialogQuestion = true" type="text" size="small">查看</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane class="second" name="second">
            <span slot="label">
              <el-badge :value="0" class="item">填空题</el-badge>
            </span>
            <el-table :data="tableData" style="width: 100%" v-if="activeName === 'second'">
              <el-table-column type="selection" width="55"></el-table-column>
              <el-table-column prop="date" label="试题题目"></el-table-column>
              <el-table-column prop="name" label="试题类型" width="180"></el-table-column>
              <el-table-column prop="address" label="分数" width="180"></el-table-column>
              <el-table-column fixed="right" label="操作" width="200">
                <template slot-scope="scope">
                  <el-button @click.native.prevent="deleteRow(scope.$index, tableData4)" type="text" size="small">查看</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane class="third" name="third">
            <span slot="label">
              <el-badge :value="0" class="item">判断题</el-badge>
            </span>
            <el-table :data="tableData" style="width: 100%" v-if="activeName === 'third'">
              <el-table-column type="selection" width="55"></el-table-column>
              <el-table-column prop="date" label="试题题目"></el-table-column>
              <el-table-column prop="name" label="试题类型" width="180"></el-table-column>
              <el-table-column prop="address" label="分数" width="180"></el-table-column>
              <el-table-column fixed="right" label="操作" width="200">
                <template slot-scope="scope">
                  <el-button @click.native.prevent="deleteRow(scope.$index, tableData4)" type="text" size="small">查看</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane class="fourth" name="fourth">
            <span slot="label">
              <el-badge :value="0" class="item">判断题</el-badge>
            </span>
            <el-table :data="tableData" style="width: 100%" v-if="activeName === 'fourth'">
              <el-table-column type="selection" width="55"></el-table-column>
              <el-table-column prop="date" label="试题题目"></el-table-column>
              <el-table-column prop="name" label="试题类型" width="180"></el-table-column>
              <el-table-column prop="address" label="分数" width="180"></el-table-column>
              <el-table-column fixed="right" label="操作" width="200">
                <template slot-scope="scope">
                  <el-button @click.native.prevent="deleteRow(scope.$index, tableData4)" type="text" size="small">查看</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane class="fifth" name="fifth">
            <span slot="label">
              <el-badge :value="0" class="item">实验题</el-badge>
            </span>
            <el-table :data="tableData" style="width: 100%" v-if="activeName === 'fifth'">
              <el-table-column type="selection" width="55"></el-table-column>
              <el-table-column prop="date" label="试题题目"></el-table-column>
              <el-table-column prop="name" label="试题类型" width="180"></el-table-column>
              <el-table-column prop="address" label="分数" width="180"></el-table-column>
              <el-table-column fixed="right" label="操作" width="200">
                <template slot-scope="scope">
                  <el-button @click.native.prevent="deleteRow(scope.$index, tableData4)" type="text" size="small">查看</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>

</template>
<script>
import $ from "jquery";
export default {
  data() {
    return {
      //预览弹出框
      dialogQuestion: false,
      activeName: "first",
      oneQuestionScore: "",
      //选中checkbox
      firstChoseData: [],
      //查看框显示
      lookContent: false,
      //是否带模板
      isModal: true,
      searchForm: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: ""
      },
      currentPage: 10,
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
          laiyuan: "laiyuan"
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
          laiyuan: "laiyuan"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address:
            "上海市普陀区金沙江路 1519 弄上海市普陀区金沙江路 1519 弄上海市普陀区金沙江路 1519 弄",
          laiyuan: "laiyuan"
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
          laiyuan: "laiyuan"
        }
      ]
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      this.lookQuestion();
    },
    handleSizeChange() {},
    handleCurrentChange() {},
    //编辑实验环境弹出关闭
    dialogImportQuestionsClose() {},
    //编辑实验环境弹出确定
    dialogImportQuestionsSubmit() {},
    tabHandleClick() {
      //选项卡切换
    },
    //checkbox选中
    firstHandleSelectionChange(val) {
      this.firstChoseData = val;
    },
    //查看
    lookQuestion() {
      let that = this;
      $(".look-question-btn")
        .mouseenter(function() {
          that.lookContent = true;
        })
        .mouseleave(function() {
          that.lookContent = false;
        });
    }
  }
};
</script>
<style lang="scss">
@import "../../../styles/layout/color_variables";
#after-select {
  width: 1200px;
  margin: 50px auto;
  .add-time {
    .el-form-item {
      margin-bottom: 0;
    }
    .button-style {
      margin-left: 10px;
    }
  }
  .is-modal {
    margin-bottom: -60px;
  }
  .is-modal-bottom {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  }
  .btn-group {
    font-size: 0;
    margin: 0 0 20px 1px;
    .btn-tab {
      display: inline-block;
      font-size: 14px;
      height: 38px;
      line-height: 38px;
      border: 1px solid #d9d9d9;
      padding: 0 20px;
      margin-left: -1px;
    }
    .btn-tab:hover,
    .btn-tab.active {
      background: $btn-blue;
      border-color: $btn-blue;
      color: #fff;
      cursor: pointer;
    }
    .el-badge__content.is-fixed {
      z-index: 9;
    }
  }
  .el-badge__content {
    right: -10px;
    z-index: 1;
  }
  .el-tabs__nav-scroll {
    overflow: initial;
    &:after {
      content: "";
      display: block;
      clear: both;
    }
  }
  .el-tabs__nav-wrap {
    overflow: initial;
  }
  .el-badge:first-child .btn-tab {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
  }
  .el-badge:last-child .btn-tab {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
  }

  .el-tabs__nav-wrap::after {
    background: none;
  }
  .el-tabs__nav {
    margin-left: 1px;
  }
  .el-tabs__item {
    border: 1px solid #d9d9d9;
    padding: 0 20px;
    height: 40px;
    line-height: 40px;
    color: #474747;
    margin-left: -1px;
  }
  .el-tabs__item.is-active {
    background: #1277eb;
    color: #fff;
  }
  .el-tabs__active-bar {
    background: none;
  }
  #tab-first {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
  }
  #tab-fifth {
    position: relative;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
  }
  .dialog-questions {
    .dialog-content {
      padding: 20px 64px 0;
      .question-title {
        font-weight: bold;
        font-size: 16px;
        margin-bottom: 20px;
      }
      .question-chose {
        font-size: 14px;
        line-height: 24px;
        padding: 6px 0;
        display: flex;
        .question-flex {
          flex: 1;
        }
      }
      .question-answer {
        font-size: 16px;
        .chose {
          font-size: 18px;
          color: #385899;
          vertical-align: -2px;
        }
        margin-top: 20px;
      }
    }
    .el-dialog__footer {
      text-align: center;
    }
  }
  .chose-model {
    margin-bottom: 10px;
  }
  .iconfont {
    margin: 0 10px;
  }
  .look-question {
    position: relative;
    display: inline-block;
    cursor: pointer;
    .look-question-content {
      cursor: auto;
      position: absolute;
      z-index: 10;
      color: #727272;
      left: 10px;
      top: 36px;
      width: 280px;
      padding: 20px 34px;
      box-sizing: border-box;
      background: #fff;
      border: 1px solid #e8e8e8;
      .look-question-item {
        display: flex;
        justify-content: space-between;
        line-height: 32px;
        border-bottom: 1px solid #e8e8e8;
        padding: 0 6px;
        font-size: 14px;
      }
      .look-question-score {
        font-size: 14px;
      }
    }
  }
  .del-modal {
    cursor: pointer;
  }
  .el-tabs__content {
    overflow: initial;
  }
  .one-question-score {
    position: absolute;
    top: -52px;
    right: 0;
    .el-input {
      width: 150px;
    }
  }
}
</style>
